/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package barbershop;

import java.util.concurrent.Semaphore;
/**
 *
 * @author Гамзатов
 */
public class BarberShop {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        int customer = 50; // посетитель
        int barber = 3; 
        int cashier = 1;
        
        variables.alldone = 0;
        variables.customerall = customer;
        for (int i = 0; i < barber; i++) {
        	new Barber().start();
        }
        for (int i = 0; i < cashier; i++) {
        	new Cashier().start();
        }
        variables.finished = new Semaphore[customer];
        for (int i = 0; i < customer; i++) {
        	variables.finished[i] = new Semaphore(0, true);
        	new Customer(i).start();
        }
    }
}